package com.mew.slots.core.game.dwsl;

import com.mew.common.rest.bo.GameSession;
import com.mew.slots.core.common.handler.AbstractBetHandler;
import com.mew.slots.core.common.handler.SlotsHandler;
import com.mew.slots.core.common.messge.response.SlotsBonusPlayResponseMessage;
import com.mew.slots.core.common.messge.response.SlotsPlayResponseMessage;
import com.mew.slots.core.common.utils.SlotsGameUtil;
import com.mew.slots.core.common.vo.StrategyGameVO;
import com.mew.slots.core.game.dwsl.roller.DwslXml;
import com.mew.slots.core.game.dwsl.service.DwslBonusService;
import com.mew.slots.core.game.dwsl.service.DwslService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author King.Song
 * @Date 2020/11/9 0009
 **/
@Service
@SlotsHandler(value = "DWSL")
@Slf4j
public class DwslHandler extends AbstractBetHandler {
    private DwslService service = new DwslService();
    private DwslBonusService bonusService = new DwslBonusService();

    @Override
    public void specialCheck(StrategyGameVO gameVO, GameSession userVO) {
    }

    @Override
    public SlotsPlayResponseMessage play(StrategyGameVO gameVO, GameSession userVO) {
        return service.Ready(gameVO);
    }

    @Override
    public SlotsBonusPlayResponseMessage playBonus(StrategyGameVO gameVO, GameSession userVO) {
        return bonusService.play(gameVO);
    }

    @Override
    public void readRoller() throws Exception {
        DwslXml.getInstance().init();
    }

    public static void main(String[] args) throws Exception {
        DwslHandler handler=new DwslHandler();
        handler.readRoller();
        StrategyGameVO vo = SlotsGameUtil.buildTestStrategyGameVO();
        vo.setLineNumber(50);
        vo.setInBetNumber(20);
        vo.setControlType(1);
        SlotsPlayResponseMessage res = handler.play(vo, null);
        System.out.println(res);
    }
}
